const http = require('http');

const server=http.createServer(function (req,res) {
    res.setHeader("Access-Control-Allow-Origin", "*");
    res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
    res.setHeader("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
    res.setHeader("X-Powered-By",' 3.2.1');
    res.setHeader("Content-Type", "application/json;charset=utf-8");

    res.end('hello world')
});

const hostName='127.0.0.1';
const port=4040;

server.listen(port,hostName,function () {
    console.log(`server is working at http://${hostName}:${port}`);
});